package com.offcn.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
public class TestController {

    //写入session
    @RequestMapping("set")
    public String testSetSession(HttpSession session){

        session.setAttribute("aaa","hellosession！");
        return "set-ok";
    }

    //读取session
    @RequestMapping("get")
    public String testReadSession(HttpSession session){
        return (String) session.getAttribute("aaa");
    }
}
